package com.huichenghe.xinlvsh01.Ble;

import android.util.Log;

import com.huichenghe.xinlvsh01.Utils.DateUtils;
import com.huichenghe.xinlvsh01.Utils.FormatUtils;

import java.util.TimeZone;

/**
 * 出来同步时间的业务类
 * Created by lixiaoning on 15-11-9.
 */
public class BleDataforSyn extends BleBaseDataManage {
    public static byte back_cmd = (byte)0xA0;
    public static byte send_cmd = (byte)0x20;

    /**
     * 同步时间
     */
    public void syncCurrentTime()
    {
        int current = DateUtils.currentTimeSeconds();  // 当前时间
        TimeZone tz = TimeZone.getDefault();           // 获取系统默认的时区
        current += tz.getRawOffset()/1000;             // 得到当前时区与0时区的偏移毫秒值

        Log.i("", "sync current = " + current);
        byte[] ret = FormatUtils.int2Byte_LH(current);
        setMsgToByteDataAndSendToDevice(send_cmd, ret, ret.length, true);
    }



}
